<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        const arr = (arrs) => {
            if (Array.isArray(arrs)) {
                const newarr = []
                for (let i = 0; i < arrs.length; i++) {
                    if (newarr.indexOf(arrs[i]) == -1) {
                        newarr.push(arrs[i]);
                    }
                }
                return newarr;
            } else {
                return 'err'
            }
        }
        const newa = arr(['a', 'a', 'b', 'e', 'w', 'r', 'd', 'p', 'e', 'w', 'd', 'p'])
        console.log(newa);
        const newa1 = arr('djg')
        console.log(newa1);

        // 查找次数

        const str = 'hughhbpyyshhshhh'
        var index = str.indexOf('h')
        let i = 0;
        while (index !== -1) {
            console.log(index);
            i++;
            index = str.indexOf('h', index + 1);
        }
        console.log('h次数:' + i);

        const ar = ['oo','hug', 'xxg', 'zyz', 'hug', 'hug']
        // var index1=ar.indexOf(ar[0])
        // while(index1!==-1){
        //      console.log(index1);
        //      index1=ar.indexOf(ar[0],index1+1)
        // }
         let nu=0;
        for (let i = 0; i < ar.length; i++) {
            if (ar[i] == 'hug' ) {
              console.log(i);
                nu++;       
            }
        }
        console.log(nu);

        

    var s='oppajgksgsoiepp'
    const o={};
    for(let i=0;i<s.length;i++){
        let ind=s.charAt(i);
        // console.log(ind);
        if(o[ind]){
          o[ind]++;
        }else{
            o[ind]=1;
        }
    }
    
    console.log(o);
    let max=0
    for(k in o){
       if(o[k]>max){
        max=o[k];
       }
    }
    console.log(max);
    
    </script>
</body>

</html>